using UnityEngine;

namespace RGuang.PlathformCtrl
{

    [CreateAssetMenu(menuName = "Data/StateMachine/PlayerState/Defeated", fileName = "PlayerState_Defeated")]

    public class PlayerState_Defeated : PlayerState
    {

        [SerializeField] ParticleSystem vfx;
        [SerializeField] AudioClip[] voices;
        public override void Enter()
        {
            base.Enter();
            Instantiate(vfx, player.transform.position, Quaternion.identity);
            SoundEffectPlayer.AudioSource.PlayOneShot(voices[Random.Range(0, voices.Length)]);

        }

        public override void LogicUpdate()
        {
            if (isAnimationFinished)
            {
                stateMachine.SwitchState(typeof(PlayerState_Float));
            }
        }
    }

}
